import { useLocation } from 'react-router-dom'
import { Descriptions, Space } from 'antd'
import moment from 'moment'
import { useRecoilValue } from 'recoil'
import { toString } from 'lodash'
import style from './style.module.less'
import IconSvg from '@/components/IconSvg'
import { dictValuesSelector } from '@/store/dicts'

export default () => {
  const location = useLocation()
  const routerValue: any = location.state
  const dictValuesSelectorValues = useRecoilValue(dictValuesSelector)

  return (
    <div className={style.examineBox}>
      {/* 顶部数据 */}
      <div className={style.topTitle}>
        <Space size={16}>
          <div>
            <span style={{ fontWeight: 600 }}>{routerValue.hospitalName}</span>
          </div>
          <div>
            <span style={{ fontSize: 12, color: '#8E8E8E' }}>{routerValue.typeIds}</span>
          </div>
          <div>
            <span style={{ fontSize: 12, color: '#8E8E8E' }}>医院编码：{routerValue.hospitalCode}</span>
          </div>
        </Space>
      </div>
      {/* 顶部数据 */}

      <div className={style.center}>
        <div className={style.buttonBox}>{/* 审核状态 */}</div>
        <div className={style.top}>用户申请</div>
        <div className={style.bottom}>
          <div className={style.bottomCenter}>
            <Descriptions column={1} bordered={false} className={style.description}>
              <Descriptions.Item label='用户角色'>
                {
                  dictValuesSelectorValues.platform_account_type.find(
                    (item: any) => item.value === toString(routerValue.accountType),
                  )?.label
                }
              </Descriptions.Item>
              <Descriptions.Item label='病区一级分类'>{routerValue.oneTypeName}</Descriptions.Item>
              <Descriptions.Item label='病区二级分类'>{routerValue.twoTypeName}</Descriptions.Item>
              <Descriptions.Item label='病区名称'>{routerValue.wardName}</Descriptions.Item>
              <Descriptions.Item label='绑定邮箱'>{routerValue.email}</Descriptions.Item>
              <Descriptions.Item label='姓名'>{routerValue.username}</Descriptions.Item>
              <Descriptions.Item label='联系电话'>{routerValue.phone}</Descriptions.Item>
              <Descriptions.Item label='登录次数'>{routerValue.loginTimes}</Descriptions.Item>
              {/*  */}
              <Descriptions.Item label='上一次登录时间'>
                {routerValue.lastLoginDate ? moment(routerValue.registeNurseNum).format('YYYY-MM-DD HH : mm : ss') : ''}
              </Descriptions.Item>
            </Descriptions>
          </div>
        </div>
        <div className={style.imageBox}>
          <IconSvg name='examineImage' style={{ width: '100%', height: '100%' }} />
        </div>
      </div>
    </div>
  )
}
